package com.mdlib.helper.ui.fragments.set;

import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.mdlib.helper.app.AppContext;
import com.ljlib.help.R;
import com.mdlib.helper.api.MDUpDateApp;
import com.mdlib.helper.base.BaseTitleFragment;

import butterknife.Bind;
import butterknife.OnClick;

/**
 * 作者：HQY on 16/11/19 10:09
 * 邮箱：hqy_xz@126.com
 */

public class AboutUsFragment extends BaseTitleFragment {


    @Bind(R.id.tv_about_product_name)
    TextView mTvAboutProductName;
    @Bind(R.id.tv_abpout_version)
    TextView mTvAbpoutVersion;
    @Bind(R.id.tv_about_company_name)
    TextView mTvAboutCompanyName;
    @Bind(R.id.tv_about_phone)
    TextView mTvAboutPhone;
    @Bind(R.id.rl_abpit_version)
    RelativeLayout mRlAbpitVersion;
    @Bind(R.id.rl_about_agent)
    RelativeLayout mRlAboutAgent;

    public static AboutUsFragment newInstance() {
        return new AboutUsFragment();
    }

    @Override
    protected int getContentLayoutId() {
        return R.layout.fragment_about_us;
    }

    @Override
    protected void initView(View rootView) {
        super.initView(rootView);
        setTitle(R.string.set_about_us, R.color.white)
                .setTitleBgColor(R.color.generic_view_bg)
                .setImgLeftListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        removeFragment();
                    }
                });
        init();

    }

    public void init() {
        mTvAbpoutVersion.setText("V " + AppContext.version);

    }


    @OnClick({R.id.rl_about_agent, R.id.rl_abpit_version})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.rl_about_agent:
                addFragment(AgentFragment.newInstance());
                break;
            case R.id.rl_abpit_version:
                MDUpDateApp.upDateApp(getActivity(), true);
                break;
        }
    }
}
